import { useEffect } from "react";

import { createConnection } from "./chat";

export function useChatRoom(serverUrl:string, roomId:string) {
  useEffect(() => {
    const connection = createConnection(serverUrl, roomId);
    connection.connect();

    return () => {
      connection.disconnect();
    };
  }, [serverUrl, roomId])

  
}